import { useEffect, useState } from 'react'

function useScroll() {
  const [y, setY] = useState(0)
  useEffect(() => {
    window.addEventListener('scroll', e => {
      setY(window.scrollY)
    })
  }, [])
  return y
}

export default useScroll
